<?php

namespace frontend\modules\dev\controllers;

use Yii;
use yii\web\Controller;
use yii\helpers\Html;

/**
 * Default controller for the `forum` module
 */
class BaseController extends Controller
{
    public $layout = 'main_dev';

    public function beforeAction($action)
    {
        if (false === parent::beforeAction($action)) {
            return false;
        }

        if(Yii::$app->user->isGuest) {
            $this->redirect('/dev/error?msg=' . '未登陆');
            return false;
        }

        if(!Yii::$app->user->can('dev')) {
            //$msg = 'no dev permission';
            $this->redirect('/dev/error?msg=' . '无权限');
            return false;
        }

        return true;
    }
}
